package cn.com.css.taxInspection.common.sysjob.utils;

import cn.com.css.taxInspection.gt3.entity.JcDsrwLogEntity;
import cn.com.css.taxInspection.gt3.service.JcDsrwLogService;
import cn.com.css.taxInspection.util.DateUtils;
import cn.com.css.taxInspection.util.TsBqUtils;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LogUtils {

    private final JcDsrwLogService jcDsrwLogService; // 使用 final 确保不可变

    // 构造方法注入
    @Autowired
    public LogUtils(JcDsrwLogService jcDsrwLogService) {
        this.jcDsrwLogService = jcDsrwLogService;
    }

    public void saveDsrwLog(String dsrwid, String dsrwmc, String zxqk, String zxqksm, String bmc) {
        JcDsrwLogEntity jcDsrwLogEntity = new JcDsrwLogEntity();
        jcDsrwLogEntity.setUuid(TsBqUtils.getUUID());
        jcDsrwLogEntity.setDsrwid(dsrwid);
        jcDsrwLogEntity.setDsrwmc(dsrwmc); // 固定为“关注查补任务”，如需扩展可加参数
        jcDsrwLogEntity.setZxqk(zxqk); // 执行情况：成功/失败
        jcDsrwLogEntity.setZxqksm(zxqksm); // 执行说明：含错误信息等
        jcDsrwLogEntity.setZxsj(DateUtils.getCurrentDate());
        jcDsrwLogEntity.setBmc(bmc);
        jcDsrwLogService.save(jcDsrwLogEntity);
    }

}
